const core = (function () {
  let heartBeat = async (pluginName, hostCode, servername) => {
    return await window.axios(
      "https://meiri56.com/rest-api/token/plugin/heartbeat",
      JSON.stringify({
        pluginName: pluginName,
        hostCode: hostCode,
        serverName: servername,
      }),
      {
        method:'POST'
      },
    )
  };
  let getAccount = async (pluginName, hostCode, servername) => {
    return await window.axios(
      "https://meiri56.com/rest-api/token/plugin/getAccount",
      JSON.stringify({
        pluginName: pluginName,
        hostCode: hostCode,
        serverName: servername,
      }),
      {
        method: "POST",
        async: false,
      },
    );
  };
  let updateAccount = async (accountInfo) => {
    return await window.axios(
      "https://meiri56.com/rest-api/token/plugin/updateAccount",
      JSON.stringify(accountInfo),
      {
        method: "post",
        async: false,
      },
    );
  };
  let sendMsg = async (hostCode, msg) => {
    return window.axios("https://meiri56.com/rest-api/token/sendMsg", JSON.stringify({
            hostCode: hostCode,
            msg: msg
        }), {
            method: "post",
            async: false
        }
    )
    
};
  return {
    heartBeat: heartBeat,
    getAccount: getAccount,
    updateAccount: updateAccount,
    sendMsg,
  };
})();
